"""
    商品控制
"""
class CommodityIterator:

    def __init__(self, data):
        self.data = data
        self.index = -1

    def __next__(self):
        self.index += 1
        if self.index == len(self.data):
            raise StopIteration
        return self.data[self.index]
        # pass


class CommodityControl:
    def __init__(self):
        self.commodity_list = []

    def __iter__(self):
        return CommodityIterator(self.commodity_list)

controller = CommodityControl()
controller.commodity_list.append("aaa")
controller.commodity_list.append("bbb")
controller.commodity_list.append("ccc")

iterator = controller.__iter__()
while True:
    try:
        item = iterator.__next__()
        print(item)
    except StopIteration:
        break